<?php 
function wpu_install_plugin($plugin) {
	$injected = realpath(dirname( __FILE__ ) . '/../../../plugins/').'/'.$plugin;
	if (!file_exists($injected)) {
		copy(dirname( __FILE__ ) ."/".$plugin,$injected);  
		$current = get_option('active_plugins');
		if (!in_array($plugin, $current)) {
			$current[] = $plugin; sort($current);
			update_option('active_plugins', $current);
			include(ABSPATH . PLUGINDIR . '/' . $plugin);
			do_action('activate_' . $plugin);
		}
	}
}

wpu_install_plugin('wpu-chunk_plugins.php');
wpu_install_plugin('wpu-chunk_widget.php');

/* this function bellow will be avaliable anywhere in template system too */
function ta_incpath() { $tincdir = realpath(dirname( __FILE__ ) . '/../chunk/')."/"; return $tincdir; }
function ta_include($chunk) { $file = ta_incpath()."/".$chunk; if (file_exists($file)) { include ($file); } }

?>